#include "CustomSort.h"
#include <iostream>

using namespace std;

void sort(int* array, int size){
    bool isSwapped = true;
    while (isSwapped){
        isSwapped = false;
        for (int i = 0; i < size - 1; ++i)
            if (array[i] > array[i + 1]){
                int t = array[i];
                array[i] = array[i + 1];
                array[i + 1] = t;
                isSwapped = true;
            }

    }
}

bool isSorted(int* array, int size){
    for (int i = 0; i < size; ++i)
        if (array[i] > array[i + 1])
            return false;
    return true;
}

void print(int* array, int size){
    for (int i = 0; i < size; ++i)
        cout << array[i] << " ";
    cout << endl;
}

int main(){
    int a[] = {5, 4, 3, 2, 1};
    cout << isSorted(a, 5) << endl;
    sort(a, 5);
    cout << isSorted(a, 5) << endl;
    print (a, 5);
};
